from flask import Flask
from apps.user.view import user_bp
from apps.article.view import article_bp
from apps.user.views import user_bp1
from ext import db, bootstrap
from settings import Config


def create_app():
    app = Flask(__name__, template_folder='../templates', static_folder='../static')  # 后面加的是模板路径，不加的话需要同一文件夹下
    app.config.from_object(Config)  # 加载配置
    db.init_app(app=app)  # 将db与app关联
    bootstrap.init_app(app=app)  # 初始化bootstrap
    # 蓝图
    app.register_blueprint(user_bp1)
    # app.register_blueprint(user_bp)
    app.register_blueprint(article_bp)
    return app
